/**
 * 
 */
package com.hydra.designpattern.staticfactorymethod;

/**
 * @Created on 2013-4-3
 * @Title:算法工厂
 * @Description:
 * @author:黄海军
 */
public class OperationFactory {
	/**
	 * 
	 * @Created on 2013-4-3
	 * @Description:工厂方法
	 * @author:黄海军
	 * @update:黄海军
	 * @param operation
	 * @return
	 * @return Operation .
	 */
	public static Operation createOperation(char operation) {
		Operation oper = null;
		switch (operation) {
		case '+':
			oper = new OperationAdd();
			break;
		case '-':
			oper = new OperationSub();
			break;
		case '*':
			oper = new OperationMul();
			break;
		case '/':
			oper = new OperationDiv();
			break;
		default:
			break;
		}
		return oper;
	}
}
